{extend name="admin@index_layout"/}
{block name="main"}
<div class="layui-card">
    <div class="layui-card-header">服务站列表</div>
    <div class="layui-card-body">
        <table class="layui-hide" id="currentTable" lay-filter="currentTable" 
            data-auth-add="{:$auth->check('business.business/add')}"
            data-auth-edit="{:$auth->check('business.business/edit')}"
            data-auth-delete="{:$auth->check('business.business/del')}"
        ></table>
    </div>
</div>

<script type="text/html" id="barTool">
    {if($status)==0}
    <a data-open='{:url("edit")}?id={{ d.id }}' class="layui-btn layui-btn-xs layui-btn-normal {:$auth->check('business.business/edit')?'':'layui-hide'}" title="服务站审核">服务站审核</a>
    {else}
    <a data-open='{:url("edit")}?id={{ d.id }}' class="layui-btn layui-btn-xs layui-btn-normal {:$auth->check('business.business/edit')?'':'layui-hide'}" title="服务站账号管理">服务站账号管理</a>
    {/if}





<!--    <a data-open='{:url("edit")}?id={{ d.id }}' class="layui-btn layui-btn-xs {:$auth->check('auth.rule/edit')?'':'layui-hide'}" title="编辑"><i class='iconfont icon-brush_fill'></i></a>-->
<!--    <a href='{:url("del")}?id={{ d.id }}' class="layui-btn layui-btn-danger layui-btn-xs layui-tr-del {:$auth->check('auth.rule/del')?'':'layui-hide'}"><i class='iconfont icon-trash_fill'></i></a>-->
</script>

<!--操作模板-->

{/block}
{block name="script"}
<script>
layui.use('yznTable', function() {
    var table = layui.yznTable;
    var init = {
        table_elem: '#currentTable',
        table_render_id: 'currentTable',
        add_url: "{:url('add')}",
        edit_url: "{:url('edit')}",
        delete_url: "{:url('del')}",
    };

    table.render({
        init: init,
        autoWidth: true,
        toolbar: ['refresh',],
        url: '{:url("index")}?status={$status}',
        cols: [
            [
                { type: 'checkbox', fixed: 'left' },
                { field: 'id', width: 50, title: 'ID' },
                { field: 'business_name', Width: 110, title: '服务站名称',searchOp: 'like' },
                { field: 'name', Width: 150, title: '联系人', searchOp: 'like' },
                { field: 'phone', Width: 120, title: '手机'},
                { field: 'username', Width: 150, title: '用户账号', searchOp: 'like'},
                { field: 'province', Width: 60, title: '省' },
                { field: 'city', Width: 60, title: '市' },
                { field: 'area', Width: 60, title: '区' },
                { field: 'status', Width: 90, title: '审核状态', templet: function(d){
                        if(d.status == 0){
                            return '<span style="color: red">待审核</span>';
                        }else if (d.status == 1){
                            return '<span style="color: green">通过</span>';
                        } else if(d.status == 2){
                            return '<span style="color: orangered">冻结</span>';
                        }
                        else {
                            return '<span>未知</span>';
                        }
                    },  search: false},
                // { field: 'status', Width: 90, title: '审核状态', templet: function(d){
                //         if(d.status == 0){
                //             return '<span style="color: red">待审核</span>';
                //         }else if (d.status == 1){
                //             return '<span style="color: green">通过</span>';
                //         } else if(d.status == 2){
                //             return '<span style="color: orangered">冻结</span>';
                //         }
                //         else {
                //             return '<span>未知</span>';
                //         }
                //     },  selectList: {0: '待审核', 1: '已审核',2: '冻结'}},
                { field: 'create_time', Width: 120, title: '创建时间',search: 'range'},
                { field: 'amount', Width: 100, title: '金钱总数' ,search: false},
                { fixed: 'right',align: 'center',Width:50, title: '操作',toolbar: '#barTool' }//delete'
            ]
        ],
        page: {}
    });
    yznTable.bindevent();
});
</script>
{/block}